/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-11-24     86159       the first version
 */
#include"timer.h"
void tm1_callback(void *parameter)
{
    rt_kprintf("tm1_callback running...\n");
}
void tm2_callback(void *parameter)
{
    rt_kprintf("tm2_callback running...\n");
}
int timer(void)
{
    //动态创建定时器
        tm1=rt_timer_create("tm1_demo", tm1_callback, RT_NULL, 3000, RT_TIMER_FLAG_PERIODIC|RT_TIMER_FLAG_SOFT_TIMER);
        if(tm1==RT_NULL)
        {
            LOG_E("rt_timer_create faile...\n");
            return -ENOMEM;
        }
        LOG_D("rt_timer_create successed...\n");
        rt_timer_start(tm1);//启动定时器

        //静态创建定时器
        rt_timer_init(&tm2, "tm2_demo", tm2_callback, RT_NULL, 3000, RT_TIMER_FLAG_PERIODIC|RT_TIMER_FLAG_SOFT_TIMER);
        rt_timer_start(&tm2);//启动定时器
        return 0;
}
